package com.bootdo.common.config;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

public class Constant {
    //演示系统账户
    public static String DEMO_ACCOUNT = "test";
    //自动去除表前缀
    public static String AUTO_REOMVE_PRE = "true";
    //停止计划任务
    public static String STATUS_RUNNING_STOP = "stop";
    //开启计划任务
    public static String STATUS_RUNNING_START = "start";
    //通知公告阅读状态-未读
    public static String OA_NOTIFY_READ_NO = "0";
    //通知公告阅读状态-已读
    public static int OA_NOTIFY_READ_YES = 1;
    //部门根节点id
    public static Long DEPT_ROOT_ID = 0L;
    //缓存方式
    public static String CACHE_TYPE_REDIS ="redis";

    public static String LOG_ERROR = "error";
    
    //数据库类型-mysql
    public static String DATA_TYPE_MYSQL = "mysql";
    //数据库类型-oracle
    public static String DATA_TYPE_ORACLE = "oracle";
    
    /**
     * 项目全路径
     */
    public static String PATH_DOMAIN = "path";

    //点对点通道名称
    public static String QUEUE_START = "topic.payee.user_";

    //广播改变排队
    public static String CHANG_SORT = "topic.change.sort";

    //广播退出排队
//    public static String EXIT_SORT = "topic.exit.sort";

    //广播心跳
//    public static String CHECK_HEART = "topic.check.heart";

    //接收心跳
    public static String RECIVE_HEART = "topic.recive.heart";

    //加入排队
//    public static String JOIN_SORT = "topic.join.sort";

    //额度变化
    public static String UPDATE_QUOTA = "topic.payee.quota";

//    public static String REDIS_LOCK_NAME = "MER_CREATE_ORDER";

//    public static String RELEASE_TIME="5";

    //通道前缀
    public static final String PASSAGEWAY = "PASSAGEWAY";

    //线程池
    public static final ThreadPoolExecutor THREADPOOL = new ThreadPoolExecutor(
                Runtime.getRuntime().availableProcessors(),
                Runtime.getRuntime().availableProcessors() * 2,
                10L,
                TimeUnit.SECONDS,
            new LinkedBlockingDeque<Runnable>(1024),
            new ThreadFactoryBuilder().setNameFormat("thread").build());

    //订单队列
    public static final String ORDER = "ORDER";

    //回单队列
    public static final String ORDER_RECEIPT = "ORDER_RECEIPT";

    //正则验证是否为base64
    public static final Pattern PATTERN = Pattern.compile("^[-\\+]?[\\d]*$");

    //文件信息key
    public static final String FILE = "file";

    //文件信息临时map
    public static final Map<String, String> MAP = new ConcurrentHashMap();

    //充值
    public static final String RECHARGE_CHECK = "RECHARGECHECK";

}
